oft = int(input())

for x in range(oft):
	ni = input()
	n = ni.split(" ")
	n[0] = int(n[0])
	n[1] = int(n[1])
	
	a = 5*n[0]
	b = 5
	for y in range(n[1]):
		if a >= b:

			a -= b
			b += 10

		else:
			a *= 100
			b = (b-b%10)*10 + b%10
	print(b)
	
